$(document).ready(function(){	
	$('#grid_stu').datagrid({ 
		url:"findStuInfoList.html",
		fit:true,
		fitColumns:true, 
		singleSelect:true,
		pageSize:10,
	    pageNumber:1,
		columns:[[
			{field:'stuName',title:'学生姓名',width:60,resizable:false,align:'center'}, 
			{field:'userName',title:'用户名',width:60,resizable:false,align:'center'}, 
			{field:'option',title:'操作',width:60,resizable:false,align:'center',
				formatter:function(value,rowData){
		        return "<a  style='font-size:normal;color:#cc0000;cursor:pointer;' onClick=doUpload('"+rowData.stuName+"','"+rowData.userName+"')>【上传资料】</a>&nbsp;"
					}
			}]],
		toolbar:'#toolbar',
		pagination:true,
	}); 
	
	
});

/**
 * 查询功能
 */
function doSearch(){
	//更新查询条件
	$('#grid_stu').datagrid({
			pageNumber:1,
			queryParams:{userName:$("#userName").val()}
	});
}
function doUpload(stuName,userName){
	/** 上传详情*/
	$('#uploadDetialWin').window({
	    title: '上传详情',
	    href:'initStuDetailUpload.html?stuName='+stuName+'&userName='+userName,
	    width: 820,
	    height: 450,
	    top: ($(window).height() - 450) * 0.5,
	    left: ($(window).width() - 820) * 0.5,
	    shadow: true,
	    modal: true,
	    closed: true,
	    minimizable: false,
	    maximizable: false,
	    collapsible: false
	});
	$('#uploadDetialWin').window('open');
}

function uploadFile(){
	var listIndex = 0;
	for(var i = 0; i<$(":file").length; i++){
		if($(":file").eq(i).val()!=""){
			$(":file").eq(i).attr("name","stuDetailList["+listIndex+"].stuFile");
			$(":file").eq(i).next().attr("name","stuDetailList["+listIndex+"].type");
			$(":file").eq(i).next().next().attr("name","stuDetailList["+listIndex+"].subType");
			listIndex ++;
		}
	}
	$("#stuDetailForm").submit();
}


